//  ant design form 组件的表单验证规则
const formRules = {
  phone: [
    'phone',
    {
      rules: [
        {
          required: true,
          message: '请填写手机号',
        },
        {
          pattern:
            /^(?:\+?86)?1(?:3\d{3}|5[^4\D]\d{2}|8\d{3}|7(?:[0-35-9]\d{2}|4(?:0\d|1[0-2]|9\d))|9[0-35-9]\d{2}|6[2567]\d{2}|4(?:(?:10|4[01])\d{3}|[68]\d{4}|[579]\d{2}))\d{6}$/,
          message: '请填写一个有效的电话',
        },
      ],
    },
  ],
  phone_verification_code: [
    'phone_verification_code',
    {
      rules: [
        {
          required: true,
          message: '请填写验证码',
        },
      ],
    },
  ],
  captcha_code: [
    'captcha_code',
    {
      rules: [
        {
          required: true,
          message: '请输入图片中的数字',
        }
      ],
    },
  ]
}

export default formRules
